class SaveButtonMenu {                       // JS 语法

    constructor() {
        this.title = '保存' // 自定义菜单标题
        this.iconSvg = '<svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 9C6 7.34315 7.34315 6 9 6H34.2814L42 13.2065V39C42 40.6569 40.6569 42 39 42H9C7.34315 42 6 40.6569 6 39V9Z" fill="#4a90e2" stroke="#4a90e2" stroke-width="4" stroke-linejoin="round"/><path fill-rule="evenodd" clip-rule="evenodd" d="M24.0083 6L24 13.3846C24 13.7245 23.5523 14 23 14H15C14.4477 14 14 13.7245 14 13.3846L14 6" fill="#FFF"/><path d="M24.0083 6L24 13.3846C24 13.7245 23.5523 14 23 14H15C14.4477 14 14 13.7245 14 13.3846L14 6H24.0083Z" stroke="#FFF" stroke-width="4" stroke-linejoin="round"/><path d="M9 6H34.2814" stroke="#4a90e2" stroke-width="4" stroke-linecap="square" stroke-linejoin="round"/><path d="M14 26H34" stroke="#FFF" stroke-width="4" stroke-linecap="square" stroke-linejoin="round"/><path d="M14 34H24.0083" stroke="#FFF" stroke-width="4" stroke-linecap="square" stroke-linejoin="round"/></svg>'
        this.tag = 'button'
    }

    // 获取菜单执行时的 value ，用不到则返回空 字符串或 false
    getValue(editor) {                              // JS 语法
        return false
    }

    // 菜单是否需要激活（如选中加粗文本，“加粗”菜单会激活），用不到则返回 false
    isActive(editor) {                    // JS 语法
        return false
    }

    // 菜单是否需要禁用（如选中 H1 ，“引用”菜单被禁用），用不到则返回 false
    isDisabled(editor) {                     // JS 语法
        return false
    }

    // 点击菜单时触发的函数
    exec(editor, value) {                              // JS 语法
        if (this.isDisabled(editor)) return
        editor.emit('save')
    }
}

export default {
    key: 'SaveButtonMenu',
    factory() {
        return new SaveButtonMenu()
    }
}